from django.shortcuts import render, get_object_or_404
from.models import News


# 考研资讯列表视图
def news_list(request):
    news_list = News.objects.all()
    return render(request, 'news/news_list.html', {'news': news_list})


# 考研资讯详情视图
def news_detail(request, news_id):
    news = get_object_or_404(News, id=news_id)
    return render(request, 'news/news_detail.html', {'news': news})